package com.base.cn.platform.os.entity.qa.question;

import com.base.cn.platform.os.common.annotation.ImgAttr;
import com.base.cn.platform.os.common.mybatis.BaseEntity;
import com.base.cn.platform.os.common.utils.StringUtils;
import com.base.cn.platform.os.entity.manage.user.SysUser;
import com.base.cn.platform.os.entity.qa.qaadd.QaAdd;
import com.base.cn.platform.os.entity.qa.qaattend.QaAttend;
import com.base.cn.platform.os.entity.qa.qatag.QaTag;
import com.base.cn.platform.os.entity.qa.qatype.QaType;
import com.base.cn.platform.os.entity.qa.record.QaTeacherCommission;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author LIZHIPENG
 * @since 2018/4/12
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class QaQuestion extends BaseEntity {

    /**提问用户ID*/
    private BigDecimal userId;
    /**提问针对套餐ID*/
    private BigDecimal packageId;
    /**提问针对课程ID*/
    private BigDecimal courseId;
    /**提问针对章节ID*/
    private BigDecimal catalogId;
    /**提问针对讲师ID*/
    private BigDecimal teacherId;
    /**提问内容*/
    @ImgAttr
    private String context;
    /**回答内容*/
    @ImgAttr
    private String replyContext;
    /**后台回答用户ID*/
    private BigDecimal replyUserId;
    /**回答时间*/
    private Date replyTime;
    /**问题图片路径串*/
    private String imageStr;
    /**是否免费：1.免费  2.付费* 3.免费向教师发起提问（归为免费但拥有）**/
    private Integer isFree;
    /**问题价格*/
    private Double price;
    /**评论数*/
    private Integer replyNum;
    /**围观数*/
    private Integer attendNum;
    /**点赞数*/
    private Integer thumbNum;
    /**浏览次数*/
    private Integer browseNum;
    /**问答分类ID*/
    private BigDecimal typeId;
    /**问答标签ID串*/
    private String tagIds;
    /**问题完结状态：1.未完结，2.已完结，3.已退费*/
    private Integer completeStatus;
    /**是否隐私：1.非隐私，2.隐私*/
    private Integer privacy;
    /**是否允许退费:1.允许,2.不允许*/
    private Integer isAllowedRefund;

    //=====================================
    /**所属问答分类*/
    private QaType qaType;
    /**提问用户*/
    private Map<String, Object> user;
    /**受问讲师*/
    private Map<String, Object> teacherMap;
    /**回答者*/
    private  Map<String, Object> replyUser;
    /**问题图片路径集合*/
    private String[] imageArr;
    /**问题追问集合*/
    private List<QaAdd> qaAddList;
    /**问题的标签集合*/
    private List<QaTag> tagList;
    /**问题对应讲师分成信息*/
    private QaTeacherCommission qaTeacherCommission;
    /**问题旁听列表*/
    private List<QaAttend> attendList;
    /**是否是提问者*/
    private Boolean questioner;
    /**是否是围观者*/
    private Boolean attender;
    /**是否是点赞者*/
    private Boolean thumber;
    /**
     * 付费问题 收益 总金额  1平台 2 教师 3提问者
     */
    private HashMap<String,Object> earnings;

    public String[] getImageArr(){
        String _imageStr = this.getImageStr();
        if(StringUtils.isNotEmpty(_imageStr)){
            String[] arr = _imageStr.split(",");
            return  arr;
        }
        return null;
    }
}
